/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.user.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pigx.common.data.datascope.PigxBaseMapper;
import com.pig4cloud.pigx.user.dto.AdminUserPageDTO;
import com.pig4cloud.pigx.user.entity.User;
import com.pig4cloud.pigx.user.vo.AdminUserPageVO;
import com.pig4cloud.pigx.user.vo.AdminUserTreeVO;
import com.pig4cloud.pigx.user.vo.SelectUserByIdListVO;
import com.pig4cloud.pigx.user.vo.TreeUserVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.core.parameters.P;

import java.math.BigDecimal;
import java.util.List;

/**
 * 
 *
 * @author pigx code generator
 * @date 2022-11-18 11:52:08
 */
@Mapper
public interface UserMapper extends PigxBaseMapper<User> {

	/**
	 * 管理端分页
	 * @param page page
	 * @param dto dto
	 * @return r
	 */
	Page<AdminUserPageVO> selectAdminPage(Page<User> page,@Param("dto") AdminUserPageDTO dto);

	/**
	 * 获取指定id的下级
	 * @param id id
	 * @return list
	 */
	List<TreeUserVO> selectChildByTree(@Param("id") Long id);

	/**
	 * 获取指定id的下级
	 * @param id id
	 * @return list
	 */
	List<AdminUserTreeVO> selectChildByAdminTree(@Param("id") Long id);

	/**
	 * 根据用户id list查询
	 * @param list list
	 * @return r
	 */
	List<SelectUserByIdListVO> selectByIdList(@Param("userList") List<Long> list);

	/**
	 * 根据用户id 单点查询
	 * @param id 用户id
	 * @return r
	 */
	SelectUserByIdListVO selectOneByIdList(@Param("userId") Long id);


	/**
	 * 用户信息更新
	 * @param id 用户id
	 * @param fuel 增长的燃料业绩
	 */
	void userAchievementQuantityCheck(@Param("id") Long id,@Param("fuel") BigDecimal fuel);

	/**
	 * 用户伞 充值业绩更新
	 * @param list 更新目标
	 * @param fuel 数量
	 */
	void updateCommunityFuelRecharge(@Param("userList") List<Long> list,@Param("fuel") BigDecimal fuel);

}
